﻿

function DY_scroll(wraper,prev,next,img,speed,or)
 { 
  var wraper = $(wraper);
  var prev = $(prev);
  var next = $(next);
  var img = $(img).find('ul');
  var w = img.find('li').outerWidth(true);
  var s = speed;
  next.click(function()
       {
        img.animate({'margin-left':-w},function()
                  {
                   img.find('li').eq(0).appendTo(img);
                   img.css({'margin-left':0});
                   });
        });
  prev.click(function()
       {
        img.find('li:last').prependTo(img);
        img.css({'margin-left':-w});
        img.animate({'margin-left':0});
        });
  if (or == true)
  {
   ad = setInterval(function() { next.click();},s*1000);
   wraper.hover(function(){clearInterval(ad);},function(){ad = setInterval(function() { next.click();},s*1000);});
  }
 }
 DY_scroll('.img-scroll','.prev','.next','.img-list',3,true);// true?????false???




function submitstart(frm)
{
var msg = new Object;

msg.firstname  = frm.elements['firstname'].value;
msg.lastname  = frm.elements['lastname'].value;
msg.email  = frm.elements['email'].value;
msg.phonenumber  = frm.elements['phonenumber'].value;
msg.postcode  = frm.elements['postcode'].value;

//msg.msg_title   = frm.elements['msg_title'].value;
//msg.msg_content = frm.elements['msg_content'].value;
//msg.captcha     = frm.elements['captcha'] ? frm.elements['captcha'].value : '';

var msg_err = '';

if (msg.firstname.length == 0)
{
msg_err += "First Name is not empty" + '\n\n'
}

/*if (msg.lastname.length == 0)
{
msg_err += "Last Name is not empty" + '\n'
}


if (msg.email.length > 0)
{
 if (!(Utils.isEmail(msg.email)))
 {
  msg_err += msg_error_email + '\n';
 }
}
else
{
  msg_err += msg_empty_email + '\n';
}*/

if (msg.phonenumber.length == 0)
{
msg_err += "Phone Number is not empty" + '\n\n'
}

if (msg.postcode.length == 0)
{
msg_err += "postcode is not empty" + '\n\n'
}

/*if (msg.msg_title.length == 0)
{
  msg_err += msg_title_empty + '\n';
}

if (frm.elements['captcha'] && msg.captcha.length==0)
{
msg_err += msg_captcha_empty + '\n'
}
if (msg.msg_content.length == 0)
{
msg_err += msg_content_empty + '\n'
}
if (msg.msg_title.length > 200)
{
msg_err += msg_title_limit + '\n';
}*/

if (msg_err.length > 0)
{
 alert(msg_err);
 return false;
}
else
{
  return true;
}
}